package com.itheima.CSM_preX.aaaController;

import com.itheima.CSM_preX.aabService.Serv.OrderServ;
import com.itheima.common.entity.Result;
import com.itheima.pojo.DTO.DTOoSubmit;
import com.itheima.pojo.VO.VOoFBI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderServ orderServ;

    @PostMapping("/findById")
    public Result findById(Integer id) {
        VOoFBI vooFBI = orderServ.findById(id);
        return new Result(true,"查询预约信息成功",vooFBI);
    }

    @PostMapping("/submitOrder")
    public Result submitOrder(@RequestBody DTOoSubmit kk) {
        Integer k = orderServ.submitOrder(kk);
        if(k==-1){
            return new Result(false,"预约失败",k);
        }
        return new Result(true,"预约成功",k);
    }
}


//        "flag": true,
//        "message": "查询预约信息成功",
//        "data": {
//        "orderType": "微信预约",
//        "member": "王美丽",
//        "orderDate": "2019-03-11",
//        "setmeal": "1112"
//        }
//        }